/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.rmi.wizard; import java.util.*; import javax.swing.*; import javax.swing.event.*; import org.openide.*; import org.openide.util.*; /** * * @author mryzl * @version */ public class AbstractWizardPanel extends javax.swing.JPanel implements WizardDescriptor.Panel { static final long serialVersionUID =-4270138704218959203L; /** Creates new form AbstractWizardPanel */ public AbstractWizardPanel() { initComponents (); } // Interface WizardDescriptor protected RMIWizardData data; /** * @associates ChangeListener */ private ArrayList list; /** Get the component displayed in this panel. * @return the component */ public java.awt.Component getComponent () { return this; } /** Help for this panel. * @return the help or <code>null</code> if no help is supplied */ public HelpCtx getHelp () { return HelpCtx.DEFAULT_HELP; } /** Provides the wizard panel with the current data--either * the default data or already-modified settings, if the user used the previous and/or next buttons. * This method can be called multiple times on one instance of <code>WizardDescriptor.Panel</code>. * @param settings the object representing wizard panel state, as originally supplied to {@link WizardDescriptor#WizardDescriptor(WizardDescriptor.Iterator,Object)} */ public void readSettings (Object settings) { if (settings instanceof RMIWizardData) readRMISettings((RMIWizardData)settings); } protected void readRMISettings (RMIWizardData data) { } /** Provides the wizard panel with the opportunity to update the * settings with its current customized state. * Rather than updating its settings with every change in the GUI, it should collect them, * and then only save them when requested to by this method. * Also, the original settings passed to {@link #readSettings} should not be modified (mutated); * rather, the (copy) passed in here should be mutated according to the collected changes. * This method can be called multiple times on one instance of <code>WizardDescriptor.Panel</code>. * @param settings the object representing a settings of the wizard */ public void storeSettings (Object settings) { if (settings instanceof RMIWizardData) storeRMISettings((RMIWizardData)settings); } protected void storeRMISettings (RMIWizardData data) { } /** Test whether the panel is finished and it is safe to proceed to the next one. * If the panel is valid, the "Next" (or "Finish") button will be enabled. * @return <code>true</code> if the user has entered satisfactory information */ public boolean isValid () { return true; } /** Fire a {@link PropertyChangeEvent} to each listener. * @param propertyName the programmatic name of the property that was changed * @param oldValue the old value of the property * @param newValue the new value of the property */ protected void fireChange() { List listclone = (List)list.clone(); Iterator it = listclone.iterator(); ChangeEvent evt = new ChangeEvent(this); while(it.hasNext()) { ChangeListener elist = (ChangeListener)it.next(); elist.stateChanged(evt); } } /** Add a listener to changes of the panel's validity. * @param l the listener to add * @see #isValid */ public void addChangeListener (ChangeListener l) { if (list == null) list = new ArrayList(); list.add(l); } /** Remove a listener to changes of the panel's validity. * @param l the listener to remove */ public void removeChangeListener (ChangeListener l) { if (list != null) { list.remove(l); } } // End of Interface WizardDescriptor /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents setLayout (new java.awt.BorderLayout ()); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } /* * <<Log>> * 5 Gandalf 1.4 11/27/99 Patrik Knakal * 4 Gandalf 1.3 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 3 Gandalf 1.2 8/12/99 Martin Ryzl hints on executors and * compiler, debug executors * 2 Gandalf 1.1 7/20/99 Martin Ryzl * 1 Gandalf 1.0 7/19/99 Martin Ryzl * $ */